

ARG NODE_VERSION=node:20.9.0-alpine

# 使用Node.js镜像作为构建阶段
FROM $NODE_VERSION AS builder
WORKDIR /app
RUN yarn --registry https://registry.npmmirror.com/  
COPY package.json  ./
RUN yarn install

 
# 使用Next.js官方镜像作为运行阶段
FROM $NODE_VERSION
WORKDIR /app
COPY --from=builder /app/node_modules /app/node_modules
COPY . .
RUN npx prisma generate

CMD ["node", "server.js"]